﻿using Newtonsoft.Json;
using System.IO;
using System.Net;

namespace Douyu.Api.Entity
{

    public class RoomEntity
    {
        /// <summary>
        /// 房间ID
        /// </summary>
        [JsonProperty(PropertyName = "room_id")]
        public int RoomId { get; set; }

        /// <summary>
        /// 房间图片，大小230*180
        /// </summary>
        [JsonProperty(PropertyName = "room_thumb")]
        public string RoomThumb { get; set; }

        //private Image img = null;

        ///// <summary>
        ///// 图片信息
        ///// </summary>
        //[JsonIgnore()]
        //public Image Image
        //{
        //    get
        //    {
        //        try
        //        {
        //            if (img == null)
        //            {
        //                var client = new WebClient();
        //                var data = client.DownloadData(this.RoomThumb);
        //                var stream = new MemoryStream(data);
        //                img = Image.FromStream(stream);
        //            }
        //        }
        //        catch
        //        {
        //            img = null;
        //        }
        //        return img;
        //    }
        //    set
        //    {
        //    }
        //}


        /// <summary>
        /// 房间所属分类ID
        /// </summary>
        [JsonProperty(PropertyName = "cate_id")]
        public string CateId { get; set; }

        /// <summary>
        /// 房间所属分类名称
        /// </summary>
        [JsonProperty(PropertyName = "cate_name")]
        public string CateName { get; set; }

        /// <summary>
        /// 房间名称
        /// </summary>
        [JsonProperty(PropertyName = "room_name")]
        public string RoomName { get; set; }

        /// <summary>
        /// 房间状态：1=开播，2=关播
        /// </summary>
        [JsonProperty(PropertyName = "room_status")]
        public string RoomStatus { get; set; }

        /// <summary>
        /// 主播昵称
        /// </summary>
        [JsonProperty(PropertyName = "owner_name")]
        public string OwnerName { get; set; }

        /// <summary>
        /// 主播头像
        /// </summary>
        [JsonProperty(PropertyName = "owner_avatar")]
        public string OwnerAvatar { get; set; }

        /// <summary>
        /// 在线人数
        /// </summary>
        [JsonProperty(PropertyName = "online")]
        public int Online { get; set; }

        /// <summary>
        /// 主播体重
        /// </summary>
        [JsonProperty(PropertyName = "owner_weight")]
        public string OwnerWeight { get; set; }

        /// <summary>
        /// 关注数
        /// </summary>
        [JsonProperty(PropertyName = "fans_num")]
        public string FansNum { get; set; }

        /// <summary>
        /// 最近开播时间
        /// </summary>
        [JsonProperty(PropertyName = "start_time")]
        public string StartTime { get; set; }

        /// <summary>
        /// 礼物数组
        /// </summary>
        [JsonProperty(PropertyName = "gift")]
        public GiftEntity[] Gift { get; set; }

    }
}
